package com.example.bes014.web.demo.custom;

import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

@Configuration
public class CustomWebMvcRegistrationsConfig {
    @Bean
    public WebMvcRegistrations webMvcRegistrations() {
        return new WebMvcRegistrations() {
            @Override
            public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
                return new CustomRequestMappingHandlerMapping();
            }
            // 如果需要，也可以自定义其他组件
        };
    }
}
class CustomRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
    @Override
    protected void initHandlerMethods() {
        super.initHandlerMethods();
        System.out.println("自定义 RequestMappingHandlerMapping 初始化完成");
    }
}
